<template>
  <div>
    <v-command :name="command">
      <div class="item">
        <icon :type="iconType" />
        <span>{{ label }}</span>
      </div>
    </v-command>
  </div>
</template>

<script>
import { Command } from 'vg-editor';
import Icon from '../Icon/index';
import upperFirst from 'lodash/upperFirst';

export default {
  name: 'MenuItem',

  props: ['command', 'icon', 'text'],

  computed: {
    iconType () {
      return `icon-${this.icon || this.command}`;
    },

    label () {
      return this.text || upperFirst(this.command);
    }
  },

  components: {
    vCommand: Command,
    Icon
  }
};
</script>
